org.eclipse.vtp.desktop.projects.core
Class FieldType

java.lang.Object
  extended by org.eclipse.vtp.desktop.projects.core.FieldType

public class FieldType
extends java.lang.Object

This class encapsulates the possible data types of business object fields.

Version:
2.0
Author:
Trip Gilman

Field Summary
static int ABSOLUTE
          A bitwise flag indicating this field type has absolute precision
static FieldType BOOLEAN
          Declaration of a typical BOOLEAN field type.
static FieldType DATETIME
          Declaration of a typical DATETIME field type.
static FieldType DECIMAL
          Declaration of a typical DECIMAL field type.
static int DOUBLE
          A bitwise flag indicating this field type has double precision
static FieldType NUMBER
          Declaration of a typical NUMBER field type.
static int SINGLE
          A bitwise flag indicating this field type has single precision
static FieldType STRING
          Declaration of a typical STRING field type.
 
Constructor Summary
protected FieldType(java.lang.String typeName)
          Creates a new FieldType with the given data type name.
 
Method Summary
static FieldType booleanArray()
          Constructs a new FieldType that represents an array of boolean values.
static FieldType custom(java.lang.String typeName, boolean object, boolean array, int precision)
          Constructs a new FieldType from the complete definition provided by the given data type name, object flag, array flag, and precision value.
static FieldType dateTimeArray()
          Constructs a new FieldType that represents an array of dates.
static FieldType decimal(int precision)
          Constructs a new FieldType that represents a decimal number with the given precision.
static FieldType decimalArray()
          Constructs a new FieldType that represents an array of decimal numbers.
static FieldType decimalArray(int precision)
          Constructs a new FieldType that represents an array of decimal numbers that will have the given precision.
 int getPrecision()
           
 java.lang.String getTypeName()
           
 boolean hasPrecision()
          Determines whether or not the precision value is applicable to this field type.
 boolean isArray()
           
 boolean isObject()
          Determines whether or not this field type represents a business object.
static FieldType load(org.w3c.dom.Element element)
          Constructs a new FieldType from the information stored in the given XML DOM sturcture.
static FieldType number(int precision)
          Constructs a new FieldType that represents a number with the given precision.
static FieldType numberArray()
          Constructs a new FieldType that represents an array of numbers.
static FieldType numberArray(int precision)
          Constructs a new FieldType that represents an array of numbers that will have the given precision.
static FieldType object(IBusinessObject objectType)
          Constructs a new FieldType that represents a business object.
static FieldType objectArray(IBusinessObject objectType)
          Constructs a new FieldType that represents an array of business objects.
static FieldType stringArray()
          Constructs a new FieldType that represents an array of strings.
 void write(org.w3c.dom.Element parent)
          Generates the XML DOM elements and attributes required to save the information for this field type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRING

public static final FieldType STRING
Declaration of a typical STRING field type.


NUMBER

public static final FieldType NUMBER
Declaration of a typical NUMBER field type.


DECIMAL

public static final FieldType DECIMAL
Declaration of a typical DECIMAL field type.


BOOLEAN

public static final FieldType BOOLEAN
Declaration of a typical BOOLEAN field type.


DATETIME

public static final FieldType DATETIME
Declaration of a typical DATETIME field type.


SINGLE

public static final int SINGLE
A bitwise flag indicating this field type has single precision

See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
A bitwise flag indicating this field type has double precision

See Also:
Constant Field Values

ABSOLUTE

public static final int ABSOLUTE
A bitwise flag indicating this field type has absolute precision

See Also:
Constant Field Values
Constructor Detail

FieldType

protected FieldType(java.lang.String typeName)
Creates a new FieldType with the given data type name. Style is defaulted to no style flags and precision is defaulted to SINGLE.

Parameters:
typeName - The data type name of this field type
Method Detail

hasPrecision

public boolean hasPrecision()
Determines whether or not the precision value is applicable to this field type.

Returns:
true if this field type has a precision, false otherwise

getPrecision

public int getPrecision()
Returns:
The current precision of this field type.

isObject

public boolean isObject()
Determines whether or not this field type represents a business object.

Returns:
true if this field type represents a business object, false otherwise

isArray

public boolean isArray()
Returns:
true if this field type represents an array of things, false otherwise

getTypeName

public java.lang.String getTypeName()
Returns:
The data type name for this field type

write

public void write(org.w3c.dom.Element parent)
Generates the XML DOM elements and attributes required to save the information for this field type.

Parameters:
parent - The parent XML DOM element that will contain the field type information

number

public static FieldType number(int precision)
Constructs a new FieldType that represents a number with the given precision.

Parameters:
precision - The precision of the number represented by the new field type
Returns:
The new FieldType

numberArray

public static FieldType numberArray()
Constructs a new FieldType that represents an array of numbers.

Returns:
The new FieldType

numberArray

public static FieldType numberArray(int precision)
Constructs a new FieldType that represents an array of numbers that will have the given precision.

Parameters:
precision - The precision of the numbers contained in the array represented by the new field type
Returns:
The new FieldType

stringArray

public static FieldType stringArray()
Constructs a new FieldType that represents an array of strings.

Returns:
The new FieldType

dateTimeArray

public static FieldType dateTimeArray()
Constructs a new FieldType that represents an array of dates.

Returns:
The new FieldType

decimal

public static FieldType decimal(int precision)
Constructs a new FieldType that represents a decimal number with the given precision.

Parameters:
precision - The precision of the decimal number represented by the new field type
Returns:
The new FieldType

decimalArray

public static FieldType decimalArray()
Constructs a new FieldType that represents an array of decimal numbers.

Returns:
The new FieldType

decimalArray

public static FieldType decimalArray(int precision)
Constructs a new FieldType that represents an array of decimal numbers that will have the given precision.

Parameters:
precision - The precision of the decimal numbers contained in the array represented by the new field type
Returns:
The new FieldType

booleanArray

public static FieldType booleanArray()
Constructs a new FieldType that represents an array of boolean values.

Returns:
The new FieldType

object

public static FieldType object(IBusinessObject objectType)
Constructs a new FieldType that represents a business object.

Parameters:
objectType - The definition of the business object type
Returns:
The new FieldType

objectArray

public static FieldType objectArray(IBusinessObject objectType)
Constructs a new FieldType that represents an array of business objects.

Parameters:
objectType - The definition of the business object type the array will contain
Returns:
The new FieldType

custom

public static FieldType custom(java.lang.String typeName,
                               boolean object,
                               boolean array,
                               int precision)
Constructs a new FieldType from the complete definition provided by the given data type name, object flag, array flag, and precision value. This function is capable of creating any possible field type.

Parameters:
typeName - The name of the data type
object - true if this field type is an object, false otherwise
array - true if this field type is an array, false otherwise
precision - The desired precision of the new field type
Returns:
The new FieldType

load

public static FieldType load(org.w3c.dom.Element element)
Constructs a new FieldType from the information stored in the given XML DOM sturcture. The information must be stored the same format produced by the write() function of this class.

Parameters:
element - The element that contains the formated data
Returns:
The new FieldType instance represented by the given field type information